//创建一个路由器，并暴露出去

//引入createRouter
import { createRouter, createWebHistory } from 'vue-router'

//引入一个一个可能要呈现的组件
import Home from '@/views/Home.vue'
import News from '@/views/News.vue'
import About from '@/views/About.vue'
import Detail from '@/views/Detail.vue'

//创建路由器，一个路由器里面有多个路由
const router = createRouter({
    history: createWebHistory(),  //路由器的工作模式
    routes: [
        {
            name: 'shouye',
            path: '/home',
            component: Home
        },
        {
            name: 'xinwen',
            path: '/news',
            component: News,
            children: [
                {
                    name: 'xiangqing',
                    path: 'detail/:id/:title/:content',
                    component: Detail
                }
            ]
        },
        {
            name: 'guanyu',
            path: '/about',
            component: About
        }
    ]
})

export default router